package com.yjd.pub.device.dao.impl;

import com.yjd.comm.base.dao.impl.BaseDaoImpl;
import com.yjd.comm.device.model.DeviceModel;
import com.yjd.comm.user.dto.UserSession;
import com.yjd.pub.device.dao.IDeviceDao;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * <b>description</b>：标的信息数据访问层 <br>
 * <b>time</b>：2015-01-27 12:28:26 <br>
 * <b>author</b>： renbangjie
 */
@Component("deviceDao")
public class DeviceDaoImpl extends BaseDaoImpl implements IDeviceDao {

	private static final String SQLMAPNAMESPACE = DeviceModel.class.getName();
	private static final String PKNAME = "device_id";

	@Override
	public int updateDeviceStatus(DeviceModel deviceModel) {
		return this.getSqlMap(true).update(
				getNamesapceToSqlmapPrefix() + "updateStatus", deviceModel);
	}

	@Override
	public UserSession getMobileUser(Map<String, Object> paramMap) {
		return (UserSession) this.getSqlMap(true).queryForObject(
				getNamesapceToSqlmapPrefix() + "getMobileUserModel", paramMap);
	}

	@Override
	public String getPrimaryKeyName() {
		return PKNAME;
	}

	@Override
	public String getSqlmapNamespace() {
		return SQLMAPNAMESPACE;
	}
	
}
